package nccloud.web.hrppl.procancel.procancelhvo.action;

import java.util.HashMap;
//import java.util.List;
import java.util.Map;
//import nccloud.framework.web.ui.pattern.grid.Grid;
import nccloud.web.codeplatform.framework.action.base.BaseAction;
import nccloud.web.codeplatform.framework.action.base.RequstParamWapper;
import nccloud.web.codeplatform.framework.action.base.RequestDTO;
import nccloud.web.codeplatform.framework.action.base.VOTransform;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.core.util.ArrayUtils;
import nccloud.framework.web.container.IRequest;
import nc.itf.hrppl.procancel.procancelhvo.IProCancelHVOService;
import nc.vo.hrppl.procancel.AggProCancelHVO;

/**
 * 保存action（主子、单表、单form）
 */
public class SaveProCancelHVOAction extends BaseAction{

	@Override
	public Object doAction(IRequest request, RequstParamWapper paramWapper) throws Throwable{
		RequestDTO param = VOTransform.toVO(paramWapper.requestString,RequestDTO.class);
		String procycle = String.valueOf(param.getBillCard().getHead().getValue("procycle"));
		if (procycle.contains(".")) {
			param.getBillCard().getHead().setValue("procycle", Integer.parseInt(procycle.split("\\.")[0]));
		}
		String pjappltype = String.valueOf(param.getBillCard().getHead().getValue("pjappltype"));
		if(pjappltype.contains(".")) {
			param.getBillCard().getHead().setValue("pjappltype", Integer.parseInt(pjappltype.split("\\.")[0]));
		}
		IProCancelHVOService service = ServiceLocator.find(IProCancelHVOService.class);

		AggProCancelHVO[] vos = this.getVOs(param, AggProCancelHVO.class);
		
		vos = service.saveAggProCancelHVO(vos[0]);
		Object result = buildResult(param,param.getBillCard().getHead()!=null,null,vos);
		return result;
	
	}
	
}